package scoutobahn.dijkstra;

import scoutobahn.highway.Highway;

/**
 * An Edge connects two DijkstraNodes.
 * It is aligned and has a fromNode and a toNode.
 * @author Richard, Antonio
 *
 */
public class Edge {

    private Highway parentHighway;
    private DijkstraNode fromNode;
    private double length;
    private DijkstraNode toNode;

    /**
     * Constructs a new Edge.
     * @param highway the Highway the Edge is on
     * @param from the Node where the Edge begins
     * @param to the Node where  the Edge ends
     * @param distanceBetween the fromNode and the ToNode
     */
    public Edge(final Highway highway, final DijkstraNode from
            , final DijkstraNode to, final double distanceBetween) {
        this.parentHighway = highway;
        fromNode = from;
        this.length = distanceBetween;
        toNode = to;
    }

    /**
     * Returns the Node at the beginning of the Edge as DijkstraNode.
     * @return fromNode the Node where the Edge begins
     */
    public DijkstraNode getFromNode() {
        return fromNode;
    }

    /**
     * Returns the length between the fromNode and the toNode.
     * @return length of the Edge
     */
    public double getLength() {
        return length;
    }

    /**
     * Returns the Node at the end of the Edge as DijkstraNode.
     * @return toNode the Node where the Edge ends
     */
    public DijkstraNode getToNode() {
        return toNode;
    }

    /**
     * Returns the parentHighway as Highway.
     * @return parentHighway
     */
    public Highway getHighway() {
        return parentHighway;
    }


}
